package com.har.modules.web.controller;

import com.har.common.exception.RRException;
import com.har.common.utils.R;
import com.har.modules.web.entity.BannerEntity;
import com.har.modules.web.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;




/**
 * banner管理
 *
 * @author maorui
 *
 */
@RestController
@RequestMapping("/banner")
public class BannerController {
    @Autowired
    private BannerService bannerService;
//
//    /**
//     * 列表
//     */
//    @RequestMapping("/list")
//    public R list(@RequestParam Map<String, Object> params) throws Exception{
//        PageUtils page = bannerService.queryPage(params);
//        return R.ok().put("page", page);
//    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        BannerEntity banner = bannerService.selectById(id);
        if(null==banner){
            throw new RRException("banner的id不存在");
        }
        return R.ok().put("banner", banner);
    }

}
